#ifndef _SIGNED_MESSAGE_HPP
#define _SIGNED_MESSAGE_HPP 1

#include <stdint.h>
#include <boost/shared_ptr.hpp>
#include "../constants.hpp"
#include "VerifiedMessageBase.hpp"

namespace BFT
{
	namespace messages
	{
		class SignedMessage : public VerifiedMessageBase
		{
		public:

			SignedMessage(uint16_t _tag, uint32_t _size, uint32_t _sender);
			
			SignedMessage(boost::shared_ptr<char> _buffer, uint32_t _buffer_length);
			
			uint32_t getSender();
			
			static uint32_t computeAuthenticationSize();
			
			void sign(); //fake signature generator
			
			bool verifySignature(); //always true, inlined
			
			void printInfo();

			
		protected:

			uint32_t startSig(); 
			
			uint32_t sender;

		};
		
		
		inline uint32_t SignedMessage::getSender() {return sender;}

		inline uint32_t SignedMessage::computeAuthenticationSize() {return SIGNATURE_SIZE + SENDER_SIZE;}

		inline uint32_t SignedMessage::startSig() {return getOffset() + getPayloadSize() + SENDER_SIZE;}

		inline bool SignedMessage::verifySignature() {return true;}
				
		
	} //namespace messages
} // namespace BFT



#endif
